
<?php include_once 'common/header.php'; ?>
<!-- admin_main -->
<div class="admin_main">
    <!-- Admin_top end -->
    <?php include_once 'common/site_left.php'; ?>
    <!-- Admin_Left End -->
    <div class="admin_right">
        <div class="admin_right_title">
            <strong>栏目管理</strong> &gt;&gt;  编辑文章分类
        </div>

        <div class="admin_right_info">
            <form action="/ychadmin/site/edit/" method="post" id="siteForm" name="siteForm">
                <input type="hidden" id="id" name="id" value="<?php echo $site['id']; ?>" />
                <div class="admin_right_info_title"><h2>编辑文章</h2></div>
                <ul>
                    <li>
                        <font color="red"><?php echo @validation_errors(); ?></font>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">分类名称：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="title" id="title" size="50"  value="<?php echo $site['title']; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="titleTip"></div> </div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">上级分类：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <select  id="parent_id" name="parent_id">
                                <option value="0">顶级分类</option>
                                <?php foreach ($site_array as $val) { ?>
                                    <option value="<?php echo $val['id'] ?>" <?php if ($val['id'] == $site['parent_id']) {
                                    echo 'selected';
                                } ?>><?php echo $val['title'] ?></option>
                                    <?php
                                    if (isset($val['category_list']) && is_array($val['category_list']) && count($val['category_list']) > 0) {
                                        foreach ($val['category_list'] as $v) {
                                            ?>
                                            <option value="<?php echo $v['id'] ?>" <?php if ($v['id'] == $site['parent_id']) {
                                    echo 'selected';
                                } ?>>----<?php echo $v['title'] ?></option>
        <?php }
    } ?>
<?php } ?>
                            </select>
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="paret_id" style="color:red;">顶级分类则无父分类</div> </div>
                    </li>

                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">url：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="url" id="url" value="<?php echo $site['url']; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="urlTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">排序：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="forder" id="forder" value="<?php echo $site['forder']; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="forderTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">分类属性：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="radio" <?php if ($site['type_set'] == 0) {
    echo 'checked="checked"';
} ?>  id="type_set_0" value="0" name="type_set"  onclick="type_set_click(this);"/>
                            <label for="type_set_0">单页</label>
                            <input type="radio" id="type_set_1" <?php if ($site['type_set'] == 1) {
    echo 'checked="checked"';
} ?> value="1" name="type_set"  onclick="type_set_click(this);"/>
                            <label for="type_set_1">列表页</label>
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="type_set_Tip"></div> </div>
                    </li>
                </ul>

                <div class="admin_right_info_title" style="margin-top:20px;"><h2></h2></div>
                <ul id="site_content">
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">简介：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
                            <script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
                            <script type="text/javascript" charset="utf-8">
                                                var editor1 = new baidu.editor.ui.Editor();
                                                editor1.render('summary');  //editor为编辑器容器的id
                            </script>
                            <textarea name="summary" id="summary" style="width:800px">
<?php echo $site['summary']; ?>
                            </textarea>
                        </div>
                    </li>
                    <li style="height:20px;">
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">内容：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <script type="text/javascript" charset="utf-8">
                                var editor = new baidu.editor.ui.Editor();
                                editor.render('content');  //editor为编辑器容器的id
                            </script>
                            <textarea name="content" id="content" style="width:800px">
<?php echo $site['content']; ?>
                            </textarea>
                        </div>
                    </li>

                </ul>
                <ul><li>
				<div class="admin_right_info_tr admin_right_info_l">&nbsp;</div>
				<div class="admin_right_info_tr admin_right_info_m"><input class="btn_b" type="submit" value="提交" style="margin-left:300px;"/></div>
                       
                    </li></ul>
            </form>
        </div>
    </div>
    <!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<script type="text/javascript">
    $(document).ready(function () {
        $.formValidator.initConfig({formID: "siteForm", debug: false, submitOnce: true,
            onError: function (msg, obj, errorlist) {
                $("#errorlist").empty();
                $.map(errorlist, function (msg) {
                    $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
            },
            submitAfterAjaxPrompt: '有数据正在异步验证，请稍等...'
        });
        $("#title").formValidator({autoModify: true, onShow: "", onFocus: "标题在1-50个汉字之间", onCorrect: ""}).inputValidator({min: 1, max: 50, onError: "标题不能为空,请确认"});
        $("#url").formValidator({autoModify: true, onShow: "", onFocus: "UEL在1-20个字符之间", onCorrect: ""}).inputValidator({min: 1, max: 20, onError: "URL必须在1-20个字符之间,请确认"});
        $("#forder").formValidator({autoModify: true, onShow: "", onFocus: "序号必须为数字", onCorrect: ""}).inputValidator({min: 0, max: 99, type: "value", onErrorMin: "排序值必须为数字,请确认"});
    });

    function type_set_click(_this) {
        var typeid = $(_this).val();

        if (typeid == 0) {
            $("#site_content").css("display", "");
        } else {
            $("#site_content").css("display", "none");
        }

    }
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>
